
import{observable,action,toJS} from "mobx"
import {ajax} from "../api"

class Chelist  {
    @observable allList = [];

    @action getAllList = (cb)=>{
        ajax.getchelist()
        .then(res=>{
            if(res.code==200){
                this.allList = res.result
            }
            cb&&cb()
        })
    }

    @action changeAlllist = payload=>{
        this.allList = payload;
    }

    @action changeUserOne=(payload)=>{
        // Proxy 不能解开  immutable 
        //  this.user 
        this.user = {
            // ...this.user,
            ...toJS(this.user),
            ...payload
            
        }
    }

}

export default new Chelist();
